<div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
    <div class="row">
        <div class="col-sm-12">
            <table class="table table-hover table-bordered">
                <tbody>
                <tr>
                    <th>姓名</th>
                    <th>手机</th>
                    <th>留言内容</th>
                    <th>操作</th>
                </tr>
                @foreach($contacts as $contact)
                <tr>
                    <td>{!! $contact->name !!}</td>
                    <td>{!! $contact->mobile !!}</td>
                    <td>{!! $contact->content !!}</td>
                    <td>

                        <div class='btn-group'>
                            {{--<a href="{!! route('contacts.edit', [$contact->id]) !!}" class='btn btn-default btn-xs'><i--}}
                                        {{--class="glyphicon glyphicon-edit"></i></a>--}}
                            {!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['class' => 'btn btn-danger btn-xs fb-delete','data-id'=> $contact->id]) !!}
                        </div>

                    </td>
                </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>


    <div class="row">
        <div class="col-sm-5">
            <div class="dataTables_info" id="example2_info" role="status" aria-live="polite">
                共{{ count($contacts) }}条记录
            </div>
        </div>

        <div class="col-sm-7">
            <div class="dataTables_paginate paging_simple_numbers">
                {{ $contacts->links() }}
            </div>
        </div>
    </div>

</div>

<script>
  $('.fb-delete').click(function () {
    var del_id = $(this).data('id');
    var _tr = $(this).closest('tr');

    $.ajax({
      type: 'get',
      url: '/root/contacts/destroy/' + del_id,
      success: function (response) {
        if (response.success) {
          _tr.fadeOut(function () {
            $(this).remove();
          });
        }
        else {
          modals.error(response.message);
        }
      }
    })

  })
</script>





